package cn.wqk.rrtf.controller;

import cn.wqk.rrtf.mapper.ManagerMapper;
import cn.wqk.rrtf.mapper.UserMapper;
import cn.wqk.rrtf.pojo.Article;
import cn.wqk.rrtf.pojo.User;
import cn.wqk.rrtf.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 吴青珂
 * @Date: 2020/07/16/17:11
 * @Description:
 */
@Controller
public class RouterController {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private ManagerMapper managerMapper;
    @Autowired
    private ArticleService articleService;
    @RequestMapping({"/","/index"})
    public String toIndex(Model model){
        List<Article> articleList = articleService.searchAllArticle();
        model.addAttribute("articleList",articleList);
        return "index";
    }
    @RequestMapping("/toLogin")
    public String toLogin(){
        return "login";
    }
    @RequestMapping("/toRegister")
    public String toRegister(){
        return "register";
    }
    @RequestMapping("/test")
    public String test(String name,
                       String userId){
        System.out.println(name);
        System.out.println(userId);
        return "用户/个人中心个人资料";
    }
}
